| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkWinUi::ThemeManager Class Referencefinal

Manages the themes within the component. More...

Inheritance diagram for nkWinUi::ThemeManager:

## Public Member Functions
System * | getSystem () const
Theme * | getActiveTheme () const
void | setActiveTheme (Theme *theme)
Theme * | createOrRetrieve (nkMemory::StringView name)
Theme * | record (nkMemory::StringView name, nkMemory::UniquePtr< Theme > resource)
Theme * | get (nkMemory::StringView name) const
Theme * | getByIndex (unsigned int index) const
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName)
void | erase (nkMemory::StringView name)
nkMemory::UniquePtr< Theme > | relinquish (nkMemory::StringView name)

## Detailed Description

Manages the themes within the component.

A Manager is always responsible for the resources allocated using it.

## Member Function Documentation

## ◆ getSystem()

System* nkWinUi::ThemeManager::getSystem | ( |  | ) | const

Returns
  The system the manager is living in.

## ◆ getActiveTheme()

Theme* nkWinUi::ThemeManager::getActiveTheme | ( |  | ) | const

Returns
  The theme currently active.

## ◆ setActiveTheme()

void nkWinUi::ThemeManager::setActiveTheme | ( | Theme * | theme | ) |

Sets the active theme to use within the component.

Parameters

  theme | The theme to use when drawing the windows in the component.

## ◆ createOrRetrieve()

Theme* nkWinUi::ThemeManager::createOrRetrieve | ( | nkMemory::StringView | name | ) |

Creates if unavailable, or retrieve if available, a theme.

Parameters

  name | The name of the theme to retrieve.

Returns
  A newly created theme if it was previously unavailable, or the theme already attached to the name if available.

## ◆ record()

Theme* nkWinUi::ThemeManager::record | ( | nkMemory::StringView | name,
|  | nkMemory::UniquePtr< Theme > | resource
| ) |  |

Records an already existing resource in the manager, passing its ownership around.

Parameters

  name | The name under which the resource should be recorded.
  resource | The resource to record.

Returns
  A raw pointer over the resource, now recorded in the manager.

## ◆ get()

Theme* nkWinUi::ThemeManager::get | ( | nkMemory::StringView | name | ) | const

Request for a theme attached to a name.

Parameters

  name | The name of the theme wanted.

Returns
  The Theme attached to the name if available, nullptr otherwise.

## ◆ getByIndex()

Theme* nkWinUi::ThemeManager::getByIndex | ( | unsigned int | index | ) | const

Returns the resource at given index, if available.

Parameters

  index | The index of the resource to retrieve.

Returns
  The resource attached to given index.

Remarks
  An index refers to the index in the manager's container, so one index can be attached through different resources depending on allocations. This method is meant to loop on all resources in one go, because of this.

## ◆ rename()

void nkWinUi::ThemeManager::rename | ( | nkMemory::StringView | currentName,
|  | nkMemory::StringView | newName
| ) |  |

Renames a resource.

Parameters

  currentName | The name of the resource to rename.
  newName | The name to reassign to the resource.

## ◆ erase()

void nkWinUi::ThemeManager::erase | ( | nkMemory::StringView | name | ) |

Erases a resource. Memory attached to it will be freed.

Parameters

  name | The name identifying the resource to erase.

## ◆ relinquish()

nkMemory::UniquePtr<Theme> nkWinUi::ThemeManager::relinquish | ( | nkMemory::StringView | name | ) |

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters

  name | The name of the recorded resource to relinquish.

Returns
  The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsWinUi/Themes/ThemeManager.h